 
 //
 //  Created by Ken on 2019/8/1.
 //  Copyright © 2019 zwb. All rights reserved.
 //
 
 import UIKit
 import ObjectMapper
 
 public struct StringTransform: TransformType {
    
    public func transformFromJSON(_ value: Any?) -> String? {
        return value.flatMap(String.init(describing:))
    }
    
    public func transformToJSON(_ value: String?) -> Any? {
        return value
    }
 
 }
 /// 先试用，不知道好不好用 double用的
 public struct StringTransform_test: TransformType {
    
    public func transformFromJSON(_ value: Any?) -> String? {
        
        if let rs = value as? Double {
              return rs.cleanZero
            }else if let rs = value as? String {
                return rs
            }else{
                return nil
            }
    }
    
    public func transformToJSON(_ value: String?) -> Any? {
        return value
    }
 
 }
 /// boo l的处理
 public struct StringTransform_bool: TransformType {
    
    public func transformFromJSON(_ value: Any?) -> String? {
        
        if let rs = value as? Bool {
            return  rs ? "true" : "false"
            }else if let rs = value as? String {
                return rs
            }else{
                return nil
            }
    }
    
    public func transformToJSON(_ value: String?) -> Any? {
        return value
    }
 
 }
 
